﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;

public class Chinese : MonoBehaviour
{
    int add = 1;
    GameObject dg;//登高
    GameObject js;//锦瑟
    GameObject gldy;//过零丁洋
    GameObject qthcx;//钱塘湖春行
    GameObject ysxc;//游山西村

    // Start is called before the first frame update
    void Start()
    {
        dg = GameObject.Find("Canvas").transform.Find("登高").gameObject;
        js = GameObject.Find("Canvas").transform.Find("锦瑟").gameObject;
        gldy = GameObject.Find("Canvas").transform.Find("过零丁洋").gameObject;
        qthcx = GameObject.Find("Canvas").transform.Find("钱塘湖春行").gameObject;
        ysxc = GameObject.Find("Canvas").transform.Find("游山西村").gameObject;

        GameObject.Find("Canvas").transform.Find("Left").GetComponent<Button>().onClick.AddListener(delegate 
        {
            add -= 1;
            if (add == 0)
                add = 5;
        });
        GameObject.Find("Canvas").transform.Find("Right").GetComponent<Button>().onClick.AddListener(delegate
        {
            add += 1;
            if (add == 6)
                add = 1;
        });
    }

    // Update is called once per frame
    void Update()
    {
        if (add == 1)
        {
            dg.SetActive(true);
            js.SetActive(false);
            gldy.SetActive(false);
            qthcx.SetActive(false);
            ysxc.SetActive(false);
        }
        if (add == 2)
        {
            dg.SetActive(false);
            js.SetActive(true);
            gldy.SetActive(false);
            qthcx.SetActive(false);
            ysxc.SetActive(false);
        }
        if (add == 3)
        {
            dg.SetActive(false);
            js.SetActive(false);
            gldy.SetActive(true);
            qthcx.SetActive(false);
            ysxc.SetActive(false);
        }
        if (add == 4)
        {
            dg.SetActive(false);
            js.SetActive(false);
            gldy.SetActive(false);
            qthcx.SetActive(true);
            ysxc.SetActive(false);
        }
        if (add == 5)
        {
            dg.SetActive(false);
            js.SetActive(false);
            gldy.SetActive(false);
            qthcx.SetActive(false);
            ysxc.SetActive(true);
        }
        if (Input.GetKeyDown(KeyCode.Escape))
        {
            SceneManager.LoadScene("LeftBrain");
        }
    }
}
